from threading import Thread

a = 10


# 线程之间变量是共享的
def add():
    global a
    a = a + 50
    print("a加上之后的值", a)


def sub():
    global a
    a = a - 30
    print("减去之后", a)


t1 = Thread(target=add)
t1.start()
t2 = Thread(target=sub)
t2.start()
t1.join()
t2.join()
print("a的最终值", a)
